import React from 'react'
import ReactDOM from 'react-dom'

//Test1调用几次？ 1+n次
export default function Test2() {
	const [sum,setSum] = React.useState(0)
	// let account = React.createRef()
	let account = React.useRef()

	function increment(){
		setSum(sum+1) //第二种更新sum的方法
	}

	function show(){
		console.log(account.current.value)
	}

	return (
		<div>
			<h2>当前求和为:{sum}</h2>
			<button onClick={increment}>+1</button>
			<input type="text" ref={account}/>
			<button onClick={show}>点我提示输入框的内容</button>
		</div>
	)
}
